unit uservisible;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxControls, cxContainer, cxCheckListBox, cxDBCheckListBox, DB,
  ADODB, dxfCheckBox, dxfQuickTyp, cxGraphics, cxCustomData, cxStyles,
  cxTL, cxMaskEdit, cxInplaceContainer, cxDBTL, cxTLData, cxCheckBox,
  cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, cxGridLevel,
  cxClasses, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
  cxGridDBTableView, cxGrid, Menus, cxLookAndFeelPainters, StdCtrls,
  cxButtons;

type
  TfmUserVisible = class(TForm)
    qry: TADOQuery;
    ds: TDataSource;
    qrylvuservisible: TStringField;
    qrylvvisible: TBooleanField;
    tv: TcxGridDBTableView;
    lv: TcxGridLevel;
    grd: TcxGrid;
    tvlvuservisible: TcxGridDBColumn;
    tvlvvisible: TcxGridDBColumn;
    cxButton1: TcxButton;
    cxButton2: TcxButton;
    cxButton3: TcxButton;
    cxButton4: TcxButton;
    procedure FormShow(Sender: TObject);
    procedure qryBeforeDelete(DataSet: TDataSet);
    procedure cxButton1Click(Sender: TObject);
    procedure cxButton2Click(Sender: TObject);
    procedure cxButton3Click(Sender: TObject);
    procedure cxButton4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    m_user: string;
  end;

var
  fmUserVisible: TfmUserVisible;

implementation
uses tools;
{$R *.dfm}

procedure TfmUserVisible.FormShow(Sender: TObject);
begin
  qry.ConnectionString := GetConnectionString;
  qry.Parameters.ParamValues['lvuser'] := m_user;
  qry.Open;
end;

procedure TfmUserVisible.qryBeforeDelete(DataSet: TDataSet);
begin
  Abort;
end;

procedure TfmUserVisible.cxButton1Click(Sender: TObject);
begin
  postdataset(qry);
  qry.UpdateBatch(arall);
end;

procedure TfmUserVisible.cxButton2Click(Sender: TObject);
begin
  qry.CancelUpdates;
end;

procedure TfmUserVisible.cxButton3Click(Sender: TObject);
begin
  qry.First;
  while not qry.Eof do
  begin
    qry.Edit;
    qrylvvisible.Value := True;
    qry.Next;
  end;
end;

procedure TfmUserVisible.cxButton4Click(Sender: TObject);
begin
  qry.First;
  while not qry.Eof do
  begin
    qry.Edit;
    qrylvvisible.Value := False;
    qry.Next;
  end;
end;

end.
